﻿using System.ServiceModel;
using System.ServiceModel.Channels;
using System.Web.Mvc;
using TechEd.Rest.Core.Interfaces;

namespace TechEd.Web.Controllers
{
	[HandleError]
	public class HomeController : Controller
	{
		public ActionResult Index()
		{
			ViewData["Message"] = "Welcome to ASP.NET MVC!";

			return View();
		}

		public ActionResult About()
		{
/*
			WSHttpBinding binding = new WSHttpBinding();
			EndpointAddress address = new EndpointAddress("http://127.0.0.1:81/Service1.svc");
*/
			ChannelFactory<IService1> factory = new ChannelFactory<IService1>(/*binding, address*/typeof(IService1).FullName);

			IService1 proxy = factory.CreateChannel();
			proxy.Test();
			((IChannel)proxy).Close();

			return View();
		}
	}
}
